$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
// this method is new with PHP 8 and above
$haystack = "Damn, I wonder if this string contains a comma.";
if (str_contains($haystack, ",")) {
echo "There is a comma!!";
}
// returns true if $needle is a substring of $haystack
function contains($haystack, $needle){
return strpos($haystack, $needle) !== false;
}